﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;


namespace MVC.Controllers
{
    public class PSAPIController : Controller
    {
        // GET: PSAPI
        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Index(string runthis,string ReqURL,string UploadData = "")
        {
            PSJSONrequests PSRequest = new PSJSONrequests();
            if(UploadData == "")
            {
                ViewBag.ResultMessage = PSRequest.retrieveURL(ReqURL);
            }
            else
            {
                ViewBag.ResultMessage = PSRequest.putURL(ReqURL, JObject.Parse(UploadData));
            }
            return View();
        }
    }
}